home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12728 < prev    next >
Encoding:
Text File  |  1996-08-05  |  797 b   |  35 lines

  1. Path: rcogate.rco.qc.ca!altitude!intermedia!1-167-700-0!trinomic.technologie
  2. From: Trinomic.Technologie@f700.n167.z1.fidonet.org (Trinomic Technologie)
  3. Date: 01 Apr 96 15:26:00 
  4. Newsgroups: comp.lang.c
  5. Subject: String problem
  6. Message-ID: <826_9604020401@intermedia.qc.ca>
  7. X-FTN-To: Shon Frazier
  8.  
  9.  
  10. "Can anyone tell me why NameCheck = 0 when I run the program"
  11.  
  12. Your program will give you always this result because you can't use "==" to
  13. compare strings:
  14.  
  15. if (WhereName == "John")
  16. {
  17.        NameCheck = 1;
  18. }
  19.  
  20. You must use fonction "strcmp()" to compare 2 strings
  21.  
  22.  ry this:
  23.  
  24. #include "string.h"
  25.  
  26. if (strcmp(WhereName, "John") == 0)
  27. ...
  28.  
  29. Stephane Mercier
  30.  
  31.  
  32.  
  33. >> De : Trinomic.Technologie@f700.n167.z1.fidonet.org ( Fidonet: Trinomic Technologie 1:167/700 ) 
  34.    Via: root@intermedia.qc.ca ( 1:242/847 )
  35.